<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <title>外协流转</title>
</head>

<body>
  <div id="app">
    <div class="order-circulation" v-if="menus.length>0">
      <el-tabs v-model="activeMenu" class="order-circulation-tabs full-tabs" v-if="menus.length>0">
        <el-tab-pane lazy v-for="menu in menus" :key="menu.name" :label="menu.label" :name="menu.name">
          <component :is="menu.url" class="menu-item"></component>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</body>

<script src="../../myJs/importFile.js"></script>
<script>
  importFile([
    "/vueSystem/components/css/pageSelect.css",
    "./css/outOrderForm.css",
    "./css/createOutOrder.css",
    "./css/createOutReturnorder.css",
    "./css/outHandover.css"
  ], [
    "/vueSystem/i18n/index.js",
    "/vueSystem/js/checkVaildUtil.js",
    "/vueSystem/js/permissionUtil.js",
    "/vueSystem/components/pageSelect.js"
  ]);
</script>
<script src="../utils/moduleUtil.js"></script>
<script src="./orderApi.js"></script>
<script src="./createOutOrder/materialOutOrder.js"></script>
<script src="./createOutOrder/electroplateOutOrder.js"></script>
<script src="./createOutOrder.js"></script>
<script src="./createOutReturnorder.js"></script>
<script src="./outHandover/materialOutHandover.js"></script>
<script src="./outHandover/electroplateOutHandover.js"></script>
<script src="./outHandover.js"></script>

<script>
  var app = new Vue({
    el: '#app',
    data: function () {
      return {
        activeMenu: '',
        menus: []
      };
    },
    created: function () {
      var menus = [{
        label: '生成外协单',
        name: 'createOutOrder',
        url: 'create-out-order',
        authority: 'putOutNew/addPutoutOrder'
      }, {
        label: '生成外协返回单',
        name: 'createOutReturnorder',
        url: 'create-out-returnorder',
        authority: 'putOutNew/returnPutOutOrder'
      }, {
        label: '外协交接',
        name: 'outHandover',
        url: 'out-handover',
        authority: 'putOutNew/putOutWarehouseToWorkshopOrWarehouse'
      }];
      var authorityList = _.map(menus, 'authority');
      var self = this;
      PermissionUtil.validateAuthority(authorityList).then(function (validate) {
        menus = _.filter(menus, function (menu) {
          return validate[menu.authority];
        });
        if (menus.length > 0) {
          self.activeMenu = menus[0].name;
          self.menus = menus;
        }
      });
    },
    components: {
      CreateOutOrder: CreateOutOrder,
      CreateOutReturnorder: CreateOutReturnorder,
      OutHandover: OutHandover
    }
  });
</script>

<style>
  .order-circulation {
    padding-left: 20px;
    height: 100%;
  }

  .menu-item {
    position: relative;
  }
</style>

</html>